#ifndef __CPPTUTORMULTITHREADING_H__
#define __CPPTUTORMULTITHREADING_H__

#ifdef WIN32
// windows thread api's
#else
#include <pthread.h>     /* pthread functions and data structures */
#include <unistd.h>
#include <stdlib.h>
#endif

#include "cppTutorMultiThreadingFunctions.h"

// log framework
#include "cppTutorLog.h"
extern CcppTutorLog Log;

const int NUM_THREADS = 5;

// struct thread_data
// {
   // int  thread_id;
   // char *message;
// };

class CcppTutorMultiThreading
{
    private:
        struct thread_data td[NUM_THREADS];
	#ifdef WIN32
		// windows thread specific
	#else
        pthread_t threads[NUM_THREADS], p_thread;
        pthread_attr_t attr;
	#endif
        static int nSharedData;
        int rc, i, thread_id, nMutexCheck;
        int a;  /* thread 1 identifying number */
        int b;  /* thread 2 identifying number */    
        void *status;
   
    public:
        int m_nReturnStatus;

    public:
		CcppTutorMultiThreading ();
	    virtual ~CcppTutorMultiThreading ();

        friend void *PrintHello(void *threadid);
        friend void *wait(void *t);
        
        int m_CreateThread();
        int m_JoiningDetachingThreads ();
        int _main ();
        #ifdef MUTEX_DEMO
        int useMutex ();
        #endif //MUTEX_DEMO
};

#endif //__CPPTUTORMULTITHREADING_H__